/**
 * Copyright (c) 2006 George Malamidis, nutrun.com
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this
 * software and associated documentation files (the "Software"), to deal in the Software
 * without restriction, including without limitation the rights to use, copy, modify,
 * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to the following
 * conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies
 * or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
 * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

/**
 * $Author$
 * $Rev$
 */

package aerie.util;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.BufferedReader;
import java.io.PrintWriter;
import java.security.Principal;
import java.util.*;

public abstract class ObjectMother {
    private static PrintWriter printWriter = new PrintWriter(System.out);

    public static HttpServletResponse createHttpServletResponse() {
        return new HttpServletResponse() {
            public void addCookie(Cookie cookie) {
                throw new UnsupportedOperationException();
            }

            public boolean containsHeader(String string) {
                throw new UnsupportedOperationException();
            }

            public String encodeURL(String string) {
                throw new UnsupportedOperationException();
            }

            public String encodeRedirectURL(String string) {
                throw new UnsupportedOperationException();
            }

            public String encodeUrl(String string) {
                throw new UnsupportedOperationException();
            }

            public String encodeRedirectUrl(String string) {
                throw new UnsupportedOperationException();
            }

            public void sendError(int i, String string) {
                throw new UnsupportedOperationException();
            }

            public void sendError(int i) {
                throw new UnsupportedOperationException();
            }

            public void sendRedirect(String string) {
                throw new UnsupportedOperationException();
            }

            public void setDateHeader(String string, long l) {
                throw new UnsupportedOperationException();
            }

            public void addDateHeader(String string, long l) {
                throw new UnsupportedOperationException();
            }

            public void setHeader(String string, String string1) {
                throw new UnsupportedOperationException();
            }

            public void addHeader(String string, String string1) {
                throw new UnsupportedOperationException();
            }

            public void setIntHeader(String string, int i) {
                throw new UnsupportedOperationException();
            }

            public void addIntHeader(String string, int i) {
                throw new UnsupportedOperationException();
            }

            public void setStatus(int i) {
                throw new UnsupportedOperationException();
            }

            public void setStatus(int i, String string) {
                throw new UnsupportedOperationException();
            }

            public String getCharacterEncoding() {
                throw new UnsupportedOperationException();
            }

            public String getContentType() {
                throw new UnsupportedOperationException();
            }

            public ServletOutputStream getOutputStream() {
                throw new UnsupportedOperationException();
            }

            public PrintWriter getWriter() {
                return printWriter;
            }

            public void setCharacterEncoding(String string) {
                throw new UnsupportedOperationException();
            }

            public void setContentLength(int i) {
                throw new UnsupportedOperationException();
            }

            public void setContentType(String string) {
                throw new UnsupportedOperationException();
            }

            public void setBufferSize(int i) {
                throw new UnsupportedOperationException();
            }

            public int getBufferSize() {
                throw new UnsupportedOperationException();
            }

            public void flushBuffer() {
                throw new UnsupportedOperationException();
            }

            public void resetBuffer() {
                throw new UnsupportedOperationException();
            }

            public boolean isCommitted() {
                throw new UnsupportedOperationException();
            }

            public void reset() {
                throw new UnsupportedOperationException();
            }

            public void setLocale(Locale locale) {
                throw new UnsupportedOperationException();
            }

            public Locale getLocale() {
                throw new UnsupportedOperationException();
            }
        };
    }

    public static HttpServletRequest createHttpServletRequest() {
        return new HttpServletRequest() {
            public String getAuthType() {
                throw new UnsupportedOperationException();
            }

            public Cookie[] getCookies() {
                throw new UnsupportedOperationException();
            }

            public long getDateHeader(String name) {
                throw new UnsupportedOperationException();
            }

            public String getHeader(String name) {
                throw new UnsupportedOperationException();
            }

            public Enumeration getHeaders(String name) {
                throw new UnsupportedOperationException();
            }

            public Enumeration getHeaderNames() {
                throw new UnsupportedOperationException();
            }

            public int getIntHeader(String name) {
                throw new UnsupportedOperationException();
            }

            public String getMethod() {
                throw new UnsupportedOperationException();
            }

            public String getPathInfo() {
                throw new UnsupportedOperationException();
            }

            public String getPathTranslated() {
                throw new UnsupportedOperationException();
            }

            public String getContextPath() {
                throw new UnsupportedOperationException();
            }

            public String getQueryString() {
                throw new UnsupportedOperationException();
            }

            public String getRemoteUser() {
                throw new UnsupportedOperationException();
            }

            public boolean isUserInRole(String name) {
                throw new UnsupportedOperationException();
            }

            public Principal getUserPrincipal() {
                throw new UnsupportedOperationException();
            }

            public String getRequestedSessionId() {
                throw new UnsupportedOperationException();
            }

            public String getRequestURI() {
                throw new UnsupportedOperationException();
            }

            public StringBuffer getRequestURL() {
                throw new UnsupportedOperationException();
            }

            public String getServletPath() {
                throw new UnsupportedOperationException();
            }

            public HttpSession getSession(boolean b) {
                return new HttpSession() {
                    public long getCreationTime() {
                        throw new UnsupportedOperationException();
                    }

                    public String getId() {
                        throw new UnsupportedOperationException();
                    }

                    public long getLastAccessedTime() {
                        throw new UnsupportedOperationException();
                    }

                    public ServletContext getServletContext() {
                        throw new UnsupportedOperationException();
                    }

                    public void setMaxInactiveInterval(int i) {
                        throw new UnsupportedOperationException();
                    }

                    public int getMaxInactiveInterval() {
                        throw new UnsupportedOperationException();
                    }

                    public HttpSessionContext getSessionContext() {
                        throw new UnsupportedOperationException();
                    }

                    public Object getAttribute(String string) {
                        throw new UnsupportedOperationException();
                    }

                    public Object getValue(String string) {
                        throw new UnsupportedOperationException();
                    }

                    public Enumeration getAttributeNames() {
                        throw new UnsupportedOperationException();
                    }

                    public String[] getValueNames() {
                        throw new UnsupportedOperationException();
                    }

                    public void setAttribute(String string, Object object) {
                        throw new UnsupportedOperationException();
                    }

                    public void putValue(String string, Object object) {
                        throw new UnsupportedOperationException();
                    }

                    public void removeAttribute(String string) {
                        throw new UnsupportedOperationException();
                    }

                    public void removeValue(String string) {
                        throw new UnsupportedOperationException();
                    }

                    public void invalidate() {
                        throw new UnsupportedOperationException();
                    }

                    public boolean isNew() {
                        throw new UnsupportedOperationException();
                    }
                };
            }

            public HttpSession getSession() {
                return null;
            }

            public boolean isRequestedSessionIdValid() {
                throw new UnsupportedOperationException();
            }

            public boolean isRequestedSessionIdFromCookie() {
                throw new UnsupportedOperationException();
            }

            public boolean isRequestedSessionIdFromURL() {
                throw new UnsupportedOperationException();
            }

            public boolean isRequestedSessionIdFromUrl() {
                throw new UnsupportedOperationException();
            }

            public Object getAttribute(String name) {
                throw new UnsupportedOperationException();
            }

            public Enumeration getAttributeNames() {
                throw new UnsupportedOperationException();
            }

            public String getCharacterEncoding() {
                throw new UnsupportedOperationException();
            }

            public void setCharacterEncoding(String name) {
                throw new UnsupportedOperationException();
            }

            public int getContentLength() {
                throw new UnsupportedOperationException();
            }

            public String getContentType() {
                throw new UnsupportedOperationException();
            }

            public ServletInputStream getInputStream() {
                throw new UnsupportedOperationException();
            }

            public String getParameter(String name) {
                throw new UnsupportedOperationException();
            }

            public Enumeration getParameterNames() {
                return new StringTokenizer("");
            }

            public String[] getParameterValues(String name) {
                throw new UnsupportedOperationException();
            }

            public Map getParameterMap() {
                return new HashMap();
            }

            public String getProtocol() {
                throw new UnsupportedOperationException();
            }

            public String getScheme() {
                throw new UnsupportedOperationException();
            }

            public String getServerName() {
                throw new UnsupportedOperationException();
            }

            public int getServerPort() {
                throw new UnsupportedOperationException();
            }

            public BufferedReader getReader() {
                throw new UnsupportedOperationException();
            }

            public String getRemoteAddr() {
                throw new UnsupportedOperationException();
            }

            public String getRemoteHost() {
                throw new UnsupportedOperationException();
            }

            public void setAttribute(String name, Object object) {
                throw new UnsupportedOperationException();
            }

            public void removeAttribute(String name) {
                throw new UnsupportedOperationException();
            }

            public Locale getLocale() {
                throw new UnsupportedOperationException();
            }

            public Enumeration getLocales() {
                throw new UnsupportedOperationException();
            }

            public boolean isSecure() {
                throw new UnsupportedOperationException();
            }

            public RequestDispatcher getRequestDispatcher(String name) {
                throw new UnsupportedOperationException();
            }

            public String getRealPath(String name) {
                throw new UnsupportedOperationException();
            }

            public int getRemotePort() {
                throw new UnsupportedOperationException();
            }

            public String getLocalName() {
                throw new UnsupportedOperationException();
            }

            public String getLocalAddr() {
                throw new UnsupportedOperationException();
            }

            public int getLocalPort() {
                throw new UnsupportedOperationException();
            }
        };
    }

    public static ServletConfig createServletConfig() {
        return new ServletConfig() {
            public String getServletName() {
                throw new UnsupportedOperationException();
            }

            public ServletContext getServletContext() {
                throw new UnsupportedOperationException();
            }

            public String getInitParameter(String name) {
                throw new UnsupportedOperationException();
            }

            public Enumeration getInitParameterNames() {
                throw new UnsupportedOperationException();
            }
        };
    }
}
